package models

type User struct {
	ID            string  `json:"id" gorm:"column:id;primaryKey;type:int;size:64;comment:主键"`
	NickName      string  `json:"nick_name" gorm:"column:nick_name;type:varchar(255);comment:昵称"`
	Phone         string  `json:"phone" gorm:"column:phone;type:varchar(30);comment:手机号"`
	OpenID        string  `json:"openid" gorm:"column:openid;type:varchar(50);index:idx_openid;comment:openid"`
	UserName      string  `json:"user_name,omitempty" gorm:"column:user_name;type:string;size:30;comment:收件人姓名"`
	TelNumber     string  `json:"tel_number,omitempty" gorm:"column:tel_number;type:string;size:20;comment:收货人手机号"`
	PostalCode    string  `json:"postal_code,omitempty" gorm:"column:postal_code;type:string;size:255;comment:邮编"`
	ProvinceName  string  `json:"province_name,omitempty" gorm:"column:province_name;type:string;size:10;comment:省份"`
	CityName      string  `json:"city_name,omitempty" gorm:"column:city_name;type:string;size:10;comment:城市"`
	CountyName    string  `json:"county_name,omitempty" gorm:"column:county_name;type:string;size:20;comment:区"`
	StreetName    string  `json:"street_name,omitempty" gorm:"column:street_name;type:string;size:20;comment:街道"`
	DetailAddress string  `json:"detail_address,omitempty" gorm:"column:detail_address;type:string;size:50;comment:详细地址"`
	Address       string  `json:"address" gorm:"column:address;type:varchar(255);comment:地址"`
	Longitude     float64 `json:"longitude" gorm:"column:longitude;type:double;comment:经度"`
	Latitude      float64 `json:"latitude" gorm:"column:latitude;type:double;comment:纬度"`
	Gender        int     `json:"gender" gorm:"column:gender;type:tinyint;comment:性别"`
	Birth         string  `json:"birth" gorm:"column:birth;type:varchar(20);comment:生日"`
	Email         string  `json:"email" gorm:"column:email;type:varchar(50);comment:邮箱"`
	Hobby         string  `json:"hobby" gorm:"column:hobby;type:varchar(255);comment:爱好"`
	Image         string  `json:"image" gorm:"column:image;type:varchar(255);comment:头像"`
	Points        int64   `json:"points" gorm:"column:points;type:bigint;default:0;comment:用户积分"`
	CreatedAt     int64   `json:"created_at" gorm:"column:created_at;type:int;size:64;comment:创建时间"`
	ChannelID     string  `json:"channel_id" gorm:"column:channel_id;type:varchar(50);comment:channel_id"`
}

func (u User) TableName() string {
	return "user"
}

// 模式自动注册
func init() {
	Models = append(Models, &User{})
}
